package com.jason.nio;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;


public class SocketClient {
	
	private static Logger log = Logger.getLogger("SocketClient.");
	
	public static void main(String[] arg){
		try {
			Socket socket = new Socket("127.0.0.1", 1984);
			ByteArrayOutputStream bous = new ByteArrayOutputStream();
			DataOutputStream dous = new DataOutputStream(bous);
			DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
			dous.writeInt(01);
			dous.flush();
			byte[] out = bous.toByteArray();
			dos.write(out);
		} catch (Exception e) {
			log.log(Level.SEVERE, "连接server时出现错误"+e.getMessage());
		}
	}

}
